﻿using UnityEngine;
using System.Collections;

public class Controls : MonoBehaviour {

	public float moveSpeed = 8f;
	public Rigidbody2D bullet;
	public static float beenHold = 60f;
	public float beenHoldModifier = 0.5f;
	Vector3 relativeSpeed;



	void FixedUpdate(){
		//recording data
		if (Input.GetKey (KeyCode.Space)) {
			beenHold += beenHoldModifier;

		}
	}

	

	
	// Update is called once per frame
	void Update () {

		//WASD movement
		if (transform.position.y < 557) {
						if (Input.GetKey (KeyCode.W)) {
								transform.Translate (0, moveSpeed, 0, Space.Self);

						}
				}
		if (transform.position.y > -557) {
						if (Input.GetKey (KeyCode.S)) {
								transform.Translate (0, -moveSpeed, 0, Space.Self);
			
						}
				}
		if (transform.position.x > -990) {
						if (Input.GetKey (KeyCode.A)) {
								transform.Translate (-moveSpeed, 0, 0, Space.Self);
			
						}
				}
		if (transform.position.x < 990) {
						if (Input.GetKey (KeyCode.D)) {
								transform.Translate (moveSpeed, 0, 0, Space.Self);			
						}
				}

		//shooting
		if (Input.GetKeyUp(KeyCode.Space)){
			Rigidbody2D bulletClone = (Rigidbody2D)Instantiate (bullet, transform.position, transform.rotation) as Rigidbody2D;




										}



								}


	}



























						
				
		


